﻿using System;
using System.ComponentModel;
using System.Web.UI;
using ClipperHouse.jQuery.Base;

namespace ClipperHouse.jQuery
{
	public class Attribute : JQuery
	{
		private const string attributeParamsParamName = "AttributeParams";

		public Attribute()
		{
			this.Params.Clear();
			Params[attributeParamsParamName] = String.Empty;
			this.IsCallbackEnabled = false;
			this.Callback = null;
		}

		public override string jQueryMethodName
		{
			get { return "attr"; }
		}

		[
		DesignerSerializationVisibility(DesignerSerializationVisibility.Content),
		PersistenceMode(PersistenceMode.InnerProperty)
		]
		public InnerProperty AttributeParams
		{
			get
			{
				return _AttributeParams;
			}
			set
			{
				_AttributeParams = value;
				Params[attributeParamsParamName] = _AttributeParams.Text.CleanCssParamsList().ToParamsExpression();
			}
		}
		private InnerProperty _AttributeParams;

		/// <summary>
		/// Hide CallbackScript, not applicable to .attr()
		/// </summary>
		private new InnerProperty Callback
		{
			get;
			set;
		}
	}
}
